package br.com.biblioteca.dao;

import java.io.Serializable;
import org.apache.log4j.Logger;

/**
 *
 * @author João Sávio C. Longo - joaosavio@gmail.com
 */
public abstract class DAOFactory implements Serializable {
    private static Logger LOG = Logger.getLogger(DAOFactory.class);

    public static final Class HIBERNATE = HibernateDAOFactory.class;

    /**
     * Factory method for instantiation of concrete factories.
     */
    public static DAOFactory instance(Class factory) {
        try {
            return (DAOFactory) factory.newInstance();
        } catch (Exception e) {
            LOG.fatal("Couldn't create DAOFactory.", e);
            throw new RuntimeException("Couldn't create DAOFactory: " + factory);
        }
    }

    
    public abstract IUserDAO getUserDAO();
    public abstract IBookDAO getBookDAO();
    public abstract ILoanDAO getLoanDAO();
}